home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_10_01
/
1001025a
< prev
next >
Wrap
Text File
|
1990-10-02
|
1KB
|
73 lines
// Source Code for C++ D_List Class
//
#include "listclas.h"
void D_List::seek(long where, int start)
{
long count;
switch(start)
{
case SEEK_SET:
top();
for (count = 0; count < where; ++count)
{
if ( at_end())
break;
next();
}
break;
case SEEK_CUR:
if (where > 0)
{
for (count = 0; count < where; ++count)
{
if ( at_end())
break;
next();
}
}
else
{
for(count = 0; count > where; ++count)
{
if ( at_top())
break;
prev();
}
}
break;
case SEEK_END:
end();
for(count = 0; count > where; ++count)
{
if ( at_top())
break;
prev();
}
break;
}
}
long D_List::total()
{
long thisone, count;
thisone = tell();
top();
count = 0;
do
{
if ( ! at_end() )
{
++count;
next();
}
} while( ! at_end() );
seek(thisone,SEEK_SET);
return(count);
}